home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: dickey@clark.net (T.E.Dickey)
- Newsgroups: comp.lang.c.moderated,comp.std.c
- Subject: Re: 'h' modifier in printf
- Followup-To: comp.lang.c.moderated,comp.std.c
- Date: 14 Mar 1996 08:20:28 -0600
- Organization: Clark Internet Services, Inc., Ellicott City, MD USA
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4i99vc$91r@solutions.solon.com>
- References: <4i801c$455@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Michael J Zehr (tada@athena.mit.edu) wrote:
- : The "h" modifier says the corresponding argument will be printed as a
- : short or unsigned short.
- ...
- : short s;
- : printf("%d", s);
- : printf("%hd", s);
- ...
- : Can these two ever be different? I'm aware of course that the short is
- : widened to an int during the function call, but this preserves the
- : value.
- sure can -- you're overlooking sign extension
-
-
- --
- Thomas E. Dickey
- dickey@clark.net
-